package com.ctsi.system.strategy.impl;

import com.ctsi.system.service.IEmpService;
import com.ctsi.system.strategy.IDataScope;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.List;

/**
 * 本部门数据权限
 *
 * @version 1.0
 * @author: wang xiao xiang
 * @date: 2021/8/9 16:20
 */
@Component(IDataScope.DEPT)
@RequiredArgsConstructor
public class DeptDataScope implements IDataScope {

    private final IEmpService empService;

    @Override
    public List<Long> getOrgIds(List<Long> orgIds, Long userId) {
        Long orgId = empService.getOrgId(userId);
        return Collections.singletonList(orgId);
    }
}